package com.nutshare.lt.util;

import java.util.Comparator;
import java.util.Map;

public class ValueComparator implements Comparator
{

    Map base;

    public ValueComparator(Map base)
    {
        this.base = base;
    }

    public int compare(Object a, Object b)
    {

        Integer aVal = (Integer) base.get(a);
        Integer bVal = (Integer) base.get(b);

        if (aVal < bVal)
        {
            return 1;
        }
        else if (aVal == bVal)
        {
            return -1;
        }
        else
        {
            return -1;
        }
    }


}
